package com.d3works.apps.sale.service.saleorder;

import com.d3works.apps.sale.db.SaleOrder;
import com.d3works.exception.D3worksException;
import java.math.BigDecimal;

public interface SaleOrderComputeService {

  public SaleOrder _computeSaleOrderLineList(SaleOrder saleOrder) throws D3worksException;

  public SaleOrder computeSaleOrder(SaleOrder saleOrder) throws D3worksException;

  /**
   * Peupler un devis.
   *
   * <p>Cette fonction permet de déterminer les tva d'un devis.
   *
   * @param saleOrder
   * @throws D3worksException
   */
  public void _populateSaleOrder(SaleOrder saleOrder) throws D3worksException;

  /**
   * Calculer le montant d'une facture.
   *
   * <p>Le calcul est basé sur les lignes de TVA préalablement créées.
   *
   * @param invoice
   * @param vatLines
   * @throws D3worksException
   */
  public void _computeSaleOrder(SaleOrder saleOrder) throws D3worksException;

  /**
   * Permet de réinitialiser la liste des lignes de TVA
   *
   * @param saleOrder Un devis
   */
  public void initSaleOrderLineTaxList(SaleOrder saleOrder);

  /**
   * Return the total price, computed from the lines. This price is usually equals to {@link
   * SaleOrder#exTaxTotal} but not in all cases.
   *
   * @param saleOrder
   * @return total price from the sale order lines
   */
  public BigDecimal getTotalSaleOrderPrice(SaleOrder saleOrder);

  /**
   * Calculate pack total in sale order lines
   *
   * @param saleOrder
   */
  public void computePackTotal(SaleOrder saleOrder);

  /**
   * Reset pack total in sale order lines
   *
   * @param saleOrder
   */
  public void resetPackTotal(SaleOrder saleOrder);
}
